/*
 * @brief 
 * @auther aolei1024@gmail.com
 * @date 2019-08-28
 */
#ifndef _CLINETCONNECT_H_
#define _CLINETCONNECT_H_

#include "KcpConnect.h"
#include <string>
#include <thread>
#include <memory>

class ClientConnect
{
    public:
        ClientConnect();
        ~ClientConnect();
        int Connect(std::string ip,int port);
        void Send(char* buf,int len);
        int Recv(char* buf,int len);
        int Close();
        static void MainFun(ClientConnect* ptr);
        void Update();
        void Logic( char *buf, int len,struct sockaddr_in addrs );
        bool Statue()
        {
            return conn->GetConnectStatue();
        }
    private:
        std::shared_ptr<KcpConnect> conn = nullptr;
        std::shared_ptr<UdpConnect> udp = nullptr;
        std::thread t1;


};


#endif //_CLINETCONNECT_H_
